﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="DetailTemplates.aspx.cs" Inherits="Cms.Web.UI.Admin.DetailTemplates" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="Stylesheet" href="Admin/Css/List.css" type="text/css" />
    <script language="javascript" type="text/javascript">
        //<![CDATA[
        function initDetailTemplateList() {
            cms.Lists.Init("detailTemplatePane", prepareDetailTemplatePopup);
        }

        function prepareDetailTemplatePopup(trigger, id, name, e) {
            var popup = document.getElementById("pnlDetailTemplatePopup");
            var hlEditProperties = document.getElementById("hlEditProperties");
            var hlEditContent = document.getElementById("hlEditContent");
            hlEditProperties.href = "Admin/EditDetailTemplate.aspx?tab=properties&id=" + id.substring(1);
            hlEditContent.href = "Admin/EditDetailTemplate.aspx?tab=content&id=" + id.substring(1);
            document.getElementById("ctl00_body_hidDeleteDetailTemplateID").value = id;
            cms.Lists.CurrentName = name;
            cms.Lists.ShowPopup(popup, trigger, "left", 0, 0, true, e);
        }

        function replaceDetailTemplate(status) {
            if (status != "ok")
                return;
            cms.Lists.ShowPaneOverlay("detailTemplatePaneOverlay");
            var ddl = document.getElementById("ctl00_body_ddlReplacements");
            var hidReplacementID = document.getElementById("ctl00_body_hidReplacementID");
            hidReplacementID.value = ddl[ddl.selectedIndex].value;
            document.getElementById("ctl00_body_btnReplace").click();
        }
        //]]>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="buttons" runat="server">
    <asp:hyperlink ID="hlNewDetailTemplate" runat="server" NavigateUrl="Admin/EditDetailTemplate.aspx" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/layout_detail_add.png" alt="" /><span><cms:LocalizedLiteral ID="llNewDetailTemplate" runat="server" /></span></span></span></asp:hyperlink>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="body" runat="server">
    <asp:Literal ID="litIcon" runat="server" Visible="false" Text="Admin/Img/Icons/layout_detail.png" />
    <div id="detailTemplatePane" style="position: relative;">
        <asp:UpdatePanel ID="upnlDetailTemplates" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <asp:Panel ID="pnlActions" runat="server" />
                <table class="list" id="tblDetailTemplates">
                    <tr>
                        <th><cms:LocalizedLiteral ID="llNameHeader" runat="server" /></th>
                        <th><cms:LocalizedLiteral ID="llSystemIdHeader" runat="server" /></th>
                        <th><cms:LocalizedLiteral ID="llDescriptionHeader" runat="server" /></th>
                    </tr>
                    <asp:Repeater ID="rpDetailTemplates" runat="server" OnItemDataBound="rpDetailTemplates_ItemDataBound">
                        <ItemTemplate>
                            <tr>
                                <td><asp:Literal ID="litID" runat="server" /><img src="Admin/Img/icons/layout_detail.png" /><span><asp:literal ID="litName" runat="server" /></span></span></td>
                                <td><asp:Literal ID="litSystemId" runat="server" /></td>
                                <td><asp:Literal ID="litDescription" runat="server" /></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
                <asp:Panel ID="pnlNoDetailTemplates" runat="server" class="noListRows"><cms:LocalizedLiteral ID="llNoDetailTemplates" runat="server" /></asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div id="detailTemplatePaneOverlay" class="paneOverlay"></div>
        <div id="detailTemplatePaneOverlayProgress" class="paneOverlayProgress"><img src="Admin/img/progress.gif" /></div>
    </div>
    <asp:UpdatePanel ID="upnlActions" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
        <ContentTemplate>
            <div id="pnlDetailTemplatePopup" class="popup">
                <div class="popupMenuTop">
                    <div class="popupMenuTopBg">&nbsp;</div>
                    <div class="popupMenuTopLeftCorner">&nbsp;</div>
                    <div class="popupMenuTopRightCorner">&nbsp;</div>
                </div>
                <div class="popupMenu">
                    <div class="popupMenuLeftBg">&nbsp;</div>
                    <div class="popupMenuRightBg">&nbsp;</div>
                    <div class="popupMenuContent">
                        <a id="hlEditContent" href="#"><img src="Admin/Img/icons/page_white_edit.png" /><span><cms:LocalizedLiteral ID="llEditContent" runat="server" /></span></a>
                        <a id="hlEditProperties" href="#"><img src="Admin/Img/icons/layout_detail_gear.png" /><span><cms:LocalizedLiteral ID="llEditProperties" runat="server" /></span></a>
                        <div class="horizontalDivider" style="margin-bottom: 3px; margin-top: 4px; margin-left: 27px; margin-right: 4px;"></div>
                        <asp:LinkButton ID="lbDelete" runat="server" OnClick="lbDelete_Click"><img id="imgDelete" runat="server" src="Admin/Img/icons/cross.png" /><span id="lblDelete" runat="server"><cms:LocalizedLiteral ID="llDeleteDetailTemplate" runat="server" /></span></asp:LinkButton>
                    </div>
                </div>
                <div class="popupMenuBottom">
                    <div class="popupMenuBottomBg">&nbsp;</div>
                    <div class="popupMenuBottomLeftCorner">&nbsp;</div>
                    <div class="popupMenuBottomRightCorner">&nbsp;</div>
                </div>
            </div>
            <input type="hidden" id="hidDeleteDetailTemplateID" runat="server" />
            <input type="hidden" id="hidReplacementID" runat="server" />
            <asp:Button ID="btnReplace" runat="server" OnClick="btnReplace_Click" Text="Replace" style="position: absolute; left: -10000px;" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <script language="javascript">
        iLib.Dom.AddListener(window, "load", initDetailTemplateList);
        cms.Ajax.Init();
        cms.Ajax.AddEndRequestHandler(cms.Lists.HidePaneOverlays);
    </script>
    <div id="replaceDetailTemplate" style="position: absolute; left: -10000px;">
        <asp:UpdatePanel ID="upnlReplacements" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <p><asp:Literal ID="litReplacementMessage" runat="server" /></p>
                <table style="margin-bottom: 10px;">
                    <tr>
                        <td><asp:literal ID="litReplacementLabel" runat="server" />:</td>
                        <td><asp:DropDownList ID="ddlReplacements" runat="server" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
